package com.comac.print.component.app.domain.gateway.enums;

import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;

/**
 * @Description 签名状态
 * @Author yy
 * @Date 2022/04/10 22:13
 */
public enum SgStatusEnum {
    SG_LOCK("00","锁定"),
    SG_ACTIVE("01","有效"),
    SG_CANCEL("02","作废");

    @Getter
    @Setter
    private String code;
    @Getter
    @Setter
    private String description;

    SgStatusEnum(String code, String description){
        this.code = code;
        this.description= description;
    }

    /**
     * 通过code获取枚举值
     * @param code
     * @return
     */
    public static SgStatusEnum getSgStatusEnumByCode(String code){
        return Arrays.stream(SgStatusEnum.values())
                .filter(sgStatusEnum -> sgStatusEnum.getCode().equals(code))
                .findFirst().orElse(null);
    }
}
